home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 5807 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.5 KB

  1. Path: erich.triumf.ca!bennett
  2. From: bennett@erich.triumf.ca (P.Bennett)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Initialising structure members - help please!
  5. Date: 20 Feb 1996 07:53 PST
  6. Organization: TRIUMF: Tri-University Meson Facility
  7. Distribution: world
  8. Message-ID: <20FEB199607530966@erich.triumf.ca>
  9. References: <4gb8hn$3m8@news.mistral.co.uk> <31298EF1.5F2C@cmt.lpr.mail.carel.fi> <4gckb1$77e@news.mistral.co.uk>
  10. NNTP-Posting-Host: ftp.triumf.ca
  11. News-Software: VAX/VMS VNEWS 1.50    
  12.  
  13. In article <4gckb1$77e@news.mistral.co.uk>, mikebarnard@mistral.co.uk (Mike Barnard) writes...
  14. >You said...
  15. >>>one.number = 1;
  16. >>>one.description = "1.   Calculate a minefield";
  17. >>You can't copy C strings with an "=".  You must use the strcpy() function.
  18.  
  19. >Thanks, I'll look at what this means. But as a learning question, (not
  20. >an argumentative one!!!),  why does this good old boy work then?
  21. >char name[]="An array of characters";
  22. >Surely "name" is an array of characters as is my "description"? It
  23. >works here. Doesn't it? This leads me on to another question actually,
  24. >but I'll start another thread with it I think. 
  25.  
  26. You can do this to _initialize_ a char array when you first declare it.  
  27.  
  28. Peter Bennett VE7CEI                | Vessels shall be deemed to be in sight
  29. Internet: bennett@triumf.ca         | of one another only when one can be
  30. Packet: ve7cei@ve7kit.#vanc.bc.ca   | observed visually from the other
  31. TRIUMF, Vancouver, B.C., Canada     |                          ColRegs 3(k)
  32. GPS and NMEA info and programs: ftp://sundae.triumf.ca/pub/peter/index.html
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.